<span page-title ng-model="repository">{{ 'Details for Repository:' | translate }} {{ repository.name }}</span>

<div data-extend-template="layouts/details-page-with-breadcrumbs.html">
  <header data-block="header">
    <h2 translate>{{ repository.name }}</h2>
  </header>

  <div data-block="item-actions" bst-feature-flag="custom_products">
    <span select-action-dropdown>
      <ul class="dropdown-menu-right" uib-dropdown-menu role="menu">
        <li role="menuitem" ng-hide="hideSyncButton(repository, false)" ng-class="{disabled: disableSyncLink()}">
          <a ng-click="syncRepository(repository)" disable-link="disableSyncLink()" translate>
            Sync Now
          </a>

          <span class="disabled" ng-show="syncInProgress(repository.last_sync)" translate>
            Cannot sync Repository, a sync is already in progress.
          </span>

          <span class="disabled" ng-show="!repository.url" translate>
            Cannot sync Repository without a URL.
          </span>

          <span class="disabled" ng-show="denied('sync_products', product)" translate>
            Cannot sync Repository without the proper permissions.
          </span>
        </li>

        <li role="menuitem" ng-hide="hideSyncButton(repository, true)" ng-class="{disabled: disableSyncLink()}">
          <a ui-sref="product.repository.advanced_sync({repositoryId: repository.id})" disable-link="disableSyncLink()" translate>
            Advanced Sync
          </a>
        </li>

        <li role="menuitem" ng-hide="hideSyncButton(repository, true)" ng-class="{disabled: disableSyncLink()}">
          <a ng-click="verifyChecksum(repository)" disable-link="disableSyncLink()" translate>
            Verify Content Checksum
          </a>
        </li>

        <li role="menuitem" ng-hide="syncInProgress(repository.last_sync) || denied('edit_products', product)">
          <a ng-click="republishRepository(repository)" translate>
            Republish Repository Metadata
          </a>

          <span class="disabled" ng-show="syncInProgress(repository.last_sync)" translate>
            Cannot republish Repository, a sync is already in progress.
          </span>

          <span class="disabled" ng-show="denied('sync_products', product)" translate>
            Cannot republish Repository without the proper permissions.
          </span>
        </li>

        <li class="divider" bst-feature-flag="custom_products"></li>
        <li role="menuitem" ng-show="canRemove(repository, product)">
          <a ng-click="openModal()" translate>
            Remove Repository
          </a>
        </li>
        <li>
          <span class="disabled" ng-hide="canRemove(repository, product)">
            <span translate>Cannot Remove</span>

            <span ng-switch="getRepoNonDeletableReason(repository, product)" model="repository">
              <i class="fa fa-question-circle" ng-switch-when="permissions"
                 uib-tooltip="{{ 'You cannot remove this repository because you do not have permission.' | translate }}"
                 tooltip-animation="false"
                 tooltip-placement="left"
                 tooltip-append-to-body="true">
              </i>
              <i class="fa fa-question-circle" ng-switch-when="published"
                 uib-tooltip="{{ 'You cannot remove this repository because it was published to a content view.' | translate }}"
                 tooltip-animation="false"
                 tooltip-placement="left"
                 tooltip-append-to-body="true">
              </i>
              <i class="fa fa-question-circle" ng-switch-when="redhat"
                 uib-tooltip="{{ 'You cannot remove this repository because it is a Red Hat repository.' | translate }}"
                 tooltip-animation="false"
                 tooltip-placement="left"
                 tooltip-append-to-body="true">
              </i>
            </span>
          </span>
        </li>
      </ul>

      <div bst-modal="removeRepository(repository)" model="repository">
        <div data-block="modal-header" translate>Remove Repository "{{ repository.name }}"?</div>
        <div data-block="modal-body" translate>Are you sure you want to remove repository "{{ repository.name }}"?</div>
      </div>
    </span>
  </div>

  <div data-block="content">
    <section ui-view></section>
  </div>
</div>
